<template>
  <div class='detail-wrap'>
    <el-dialog v-model="dialogVisible" :title="title" width="800px" class="one-dialog" draggable @close="emit('close')">
      <el-form ref="ruleFormRef" :model="ruleForm">
        <el-row>
          <el-col :span='8'>
            <el-form-item label="拉取单号">{{ruleForm.code}}</el-form-item>
          </el-col>
          <el-col :span='8'>
            <el-form-item label="申请人">{{ruleForm.applyUser}}</el-form-item>
          </el-col>
          <el-col :span='8'>
            <el-form-item label="申请时间">{{ruleForm.time}}</el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table :data="tableData" size='small'>
        <el-table-column type="index" label='序号' align='center' width="80" />
        <el-table-column label="能力编码" prop="code" />
        <el-table-column label="能力名称" prop="name" />
        <el-table-column label="提供单位" prop="provider" />
        <el-table-column label="能力版本号" prop="tag" />
        <el-table-column label="操作" width='100'>
          <template #default="scope">
            <el-button link type="primary" size="small" @click='goDetail(scope.row)'>详情</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-form-item label="申请用途">{{ruleForm.use}}</el-form-item>
    </el-dialog>
  </div>
</template>
<script lang='ts' setup>
import to from 'await-to-js'
import type { FormInstance } from 'element-plus'

const emit = defineEmits(['close'])
const title = ref('拉取详情')
const dialogVisible = ref<boolean>(true)
const ruleForm = ref({
  id: 1,
  orgName: '中国移动通信集团河北有限公司',
  code: '100100001',
  time: '2020-09-01 13:44:21',
  applyUser: '叶静宜',
  status: 0,
  use: '能力使用'
})
const tableData = ref([
  {
    Request_No: '100100001',
    code: 'A00100200001',
    abilityId: '56ea8332a16448c6a8e350e910ed244c',
    name: '三户信息',
    tag: 'API_3.0_java',
    type: '产品能力',
    method: 'API',
    onStatus: '待上架',
    Listed: '',
    Delisted: '',
    bereviewedStatus: '待评审',
    Reviewpassed: '',
    Reviewrejection: '',
    betestedStatus: '待测试',
    Testpassed: '',
    TestReject: '',
    describe: '提供客户、账户、卡、群组、生命周期信息查询能力',
    banner: '',
    belong: '重庆',
    provider: '中移物联网公司',
    contact: '吉小天',
    contactPhone: '15219466201',
    mailbox: 'zhouyaojia@hdu.edu.cn',
    uploadUser: '重庆公司',
    uploadTime: '2024/2/3 12:12:12',
    pullCount: '1'
  },
  {
    Request_No: '100100002',
    code: 'A00100200002',
    abilityId: 'e4b0ebda79c148cfb54eb417c5f6e216',
    name: '通信管理',
    tag: 'API_2.1_java',
    type: '产品能力',
    method: 'API',
    onStatus: '待上架',
    Listed: '',
    Delisted: '',
    bereviewedStatus: '待评审',
    Reviewpassed: '',
    Reviewrejection: '',
    betestedStatus: '待测试',
    Testpassed: '',
    TestReject: '',
    describe: '提供流量、语音、短信服务开停查询和办理等能力',
    banner: '',
    belong: '重庆',
    provider: '中移物联网公司',
    contact: '刘星彤',
    contactPhone: '15036222256',
    mailbox: 'zhangyanfei@hdu.edu.cn',
    uploadUser: '重庆公司',
    uploadTime: '2024/1/4 21:10:10',
    pullCount: '0'
  },
  {
    Request_No: '100100003',
    code: 'A00100200003',
    abilityId: 'fd2a405646b8461bb6deef37e19f26c6',
    name: '用量管理',
    tag: 'API_2.21_java',
    type: '产品能力',
    method: 'API',
    onStatus: '待上架',
    Listed: '',
    Delisted: '',
    bereviewedStatus: '待评审',
    Reviewpassed: '',
    Reviewrejection: '',
    betestedStatus: '待测试',
    Testpassed: '',
    TestReject: '',
    describe: '提供流量、语音、短信、流量池用量信息查询等能力',
    banner: '',
    belong: '重庆',
    provider: '中移物联网公司',
    contact: '佟大能',
    contactPhone: '18438888133',
    mailbox: 'zhang1994@hdu.edu.cn',
    uploadUser: '重庆公司',
    uploadTime: '2024/1/5 21:10:10',
    pullCount: '0'
  },
  {
    Request_No: '100100005',
    code: 'A00100200005',
    abilityId: '9b6107e9eea34cf4affb971865454ba6',
    name: '风险防控',
    tag: 'API_2.23_java',
    type: '产品能力',
    method: 'SDK',
    onStatus: '待上架',
    Listed: '',
    Delisted: '',
    bereviewedStatus: '待评审',
    Reviewpassed: '',
    Reviewrejection: '',
    betestedStatus: '待测试',
    Testpassed: '',
    TestReject: '',
    describe: '提供识别物联卡安全合规风险并进行风险卡处置等能力',
    banner: '',
    belong: '重庆',
    provider: '中移物联网公司',
    contact: '海铭',
    contactPhone: '18876622089',
    mailbox: 'qianya@hdu.edu.cn',
    uploadUser: '重庆公司',
    uploadTime: '2024/1/7 21:10:10',
    pullCount: '0'
  },
])

const props = defineProps<{
  currentRow: any
}>()

const goDetail = (row: any) => {
  window.open(`http://10.12.6.88/demo/ability/${row.abilityId}`, '_blank')
}
onMounted(() => {
  if (props.currentRow) {
    const data = JSON.parse(JSON.stringify(props.currentRow))
    ruleForm.value = data
  }
})
</script>
<style lang='scss' scoped>
.detail-wrap{

}
</style>